package com.hi3v.auth.monitor.db;

import com.hi3v.auth.monitor.core.LoginRecord;
import com.hi3v.auth.monitor.core.Person;
import org.jdbi.v3.sqlobject.config.RegisterBeanMapper;
import org.jdbi.v3.sqlobject.customizer.Bind;
import org.jdbi.v3.sqlobject.statement.SqlQuery;
import org.jdbi.v3.sqlobject.statement.SqlUpdate;

import java.util.List;


public interface LoginRecordDAO {

    @SqlUpdate("insert into login_record(auth_key, companyName, endDate, serverIp, clientIp, userName) values (:auth_key,:companyName,:endDate,:serverIp,:clientIp,:userName)")
    void insert(@Bind("auth_key") String auth_key, @Bind("companyName") String companyName,@Bind("endDate") String endDate,@Bind("serverIp") String serverIp,@Bind("clientIp") String clientIp,@Bind("userName") String userName);

    @SqlQuery("select *  from login_record  ")
    @RegisterBeanMapper(LoginRecord.class)
    List<LoginRecord> findAll();
}
